package com.lijiajia.cloud.authserver.pojo.mongodb;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.experimental.Accessors;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.mongodb.core.mapping.Document;

import java.time.LocalDateTime;

/**
 * 用户 连接
 *
 * @author lijiajia
 * @since 2019-05-07
 */
@Data
@Accessors(chain = true)
@Document("user_connection")
public class UserConnection {

    @Id
    @JsonIgnore
    private ObjectId mongoId;

    /**
     * 用户ID
     */
    private String userId;

    /**
     * 提供商id
     */
    private String providerId;

    /**
     * 提供商openId
     */
    private String openId;

    /**
     * 账号排名
     */
    private Long rank;

    /**
     * 显示名称
     */
    private String nickname;

    /**
     * 个人主页
     */
    private String profile;

    /**
     * 图片地址
     */
    private String picture;

    /**
     * 创建时间
     */
    @CreatedDate
    private LocalDateTime createdAt;
    public static final String CREATED_AT = "created_at";
    /**
     * 最后修改时间
     */
    @LastModifiedDate
    private LocalDateTime lastModifiedAt;
    public static final String LAST_MODIFIED_AT = "last_modified_at";

    public static final String USER_ID = "user_id";
    public static final String PROVIDER_ID = "provider_id";
    public static final String OPEN_ID = "open_id";
    public static final String RANK = "rank";

}
